package demo1;

import java.util.Random;
import java.util.Scanner;

public class demo_8 {
    public static void grabRedPacket(){
        int a[] = {9, 666, 188, 520, 99999};
        boolean[] b = new boolean[5];
        Random r = new  Random();
        Scanner sc = new Scanner(System.in);
        int k;
        for (int i = 0; i < 5; i++){
            System.out.println("请按任意键，进行抽奖：");
            String s = sc.next();
            while(true){
                k = r.nextInt(5);
                if (b[k] == false){
                    break;
                }
            }
            System.out.println("恭喜你，抽中了:" + a[k]);
            b[k] = true;
        }
        System.out.println("红包已全部发完~~");
    }
    public static void main(String[] args) {
        grabRedPacket();

    }
}
